<template>
  <div>
    <!-- 权限列表导航 -->
    <Nav>
      <el-breadcrumb-item
        slot="nav"
        v-for="(item,index) in breadcrumbList"
        :key="index"
        :to="{ path : item.href}"
      >{{item.name}}</el-breadcrumb-item>
    </Nav>
    <!-- 中间卡片内容 -->
    <el-card>
      <!-- 表单内容 -->
      <el-table :data="rightsTable" style="width: 100%" stripe border>
        <el-table-column width="80" type="index"></el-table-column>
        <el-table-column prop="authName" label="权限名称" width="180"></el-table-column>
        <el-table-column prop="path" label="路径" width="180"></el-table-column>
        <el-table-column prop="level" label="权限等级"></el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import Nav from '../nav'
export default {
  data() {
    return {
      rightsTable: [],
      breadcrumbList: [
        {
          name: '首页',
          href: '/welcome',
        },
        {
          name: '权限管理',
        },
        {
          name: '权限列表',
        },
      ],
    }
  },
  methods: {
    async getRights() {
      const { data: res } = await this.$http.get('rights/' + 'list')
      if (res.meta.status !== 200)
        return this.$message.error('用户获取列表失败')
      this.rightsTable = res.data
    },
  },
  created() {
    this.getRights()
  },
  components: {
    Nav,
  },
}
</script>

<style>
</style>